﻿using FluentValidation;
using Mes.Application.DTO.Inputs.Quality;

namespace Mes.Application.Web.Validators.Quality
{
    public class QmSpecUpdatingInputValidator : AbstractValidator<QmSpecUpdatingInput>
    {
        public QmSpecUpdatingInputValidator()
        {
            RuleFor(x => x.Qm_Spec_Name).NotEmpty().WithMessage("质量规格名称不能为空");
            RuleFor(x => x.Qm_Spec_Id).GreaterThanOrEqualTo(0).WithMessage("质量规格Id必须大于等于0");
            RuleFor(x => x.Ent_Id).GreaterThanOrEqualTo(0).WithMessage("质量规格关联的生产单元不能为空");
            RuleFor(x => x.Plan_Id).GreaterThanOrEqualTo(0).WithMessage("质量规格关联的采样计划名称不能为空");
            RuleFor(x => x.QmSpecChars.Count()).GreaterThanOrEqualTo(0).WithMessage("质量规格关联的特性不能为空");
        }
    }
}
